﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Sharp.Domain.Model;
using Sharp.Domain.PlatformBoundedContext.WorkFlowModule.Engine.Common;
using Sharp.Infrastructure;

namespace Sharp.Domain.PlatformBoundedContext.WorkFlowModule.Aggregates
{
    /// <summary>
    /// 流程实体类
    /// </summary>
    [Table("WorkFlow_Process")]
    public class ProcessEntity : IAggregateRoot<int>, ILogCreatedEntity, ILogModifiEntity
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Column(Order = 0)]
        public int Id { get; set; }

        [Required]
        [Column(Order = 1)]
        [MaxLength(100), NonUnicode]
        public string ProcessGUID { get; set; }

        [Required]
        [Column(Order = 2)]
        [MaxLength(50)]
        public string ProcessName { get; set; }

        [Required]
        [Column(Order = 3)]
        [MaxLength(20)]
        public string Version { get; set; }

        [Required]
        [Column(Order = 4)]
        public bool IsUsing { get; set; }

        [Column(Order = 5)]
        [MaxLength(20), NonUnicode]
        public string AppType { get; set; }

        [Column(Order = 6)]
        [MaxLength(100), NonUnicode]
        public string PageUrl { get; set; }

        [Column(Order = 7)]
        [MaxLength(50)]
        public string XmlFileName { get; set; }

        [Column(Order = 8)]
        [MaxLength(50)]
        public string XmlFilePath { get; set; }

        [Column(Order = 9)]
        [IsMaxLength]
        public string XmlContent { get; set; }

        [Required]
        [Column(Order = 10)]
        public byte StartType { get; set; }

        [Column(Order = 11)]
        [MaxLength(100), NonUnicode]
        public string StartExpression { get; set; }

        [Required]
        [Column(Order = 12)]
        public EventTriggerEnum EndType { get; set; }

        [Column(Order = 13)]
        [MaxLength(100), NonUnicode]
        public string EndExpression { get; set; }

        [Column(Order = 14)]
        [MaxLength(1000)]
        public string Description { get; set; }

        [Column(Order = 15)]
        public DateTime? CreatedTime { get; set; }

        [Column(Order = 16)]
        public int? CreatedUserId { get; set; }
        [Column(Order = 17)]
        public DateTime? ModifiTime { get; set; }
        [Column(Order = 18)]
        public int? ModifiedUserId { get; set; }
    }
}
